package cn.wolfcode.expection;

import cn.wolfcode.domain.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.sql.SQLIntegrityConstraintViolationException;

@RestControllerAdvice
public class GlobalException {
@ExceptionHandler(SQLIntegrityConstraintViolationException.class)
    public Result normalException(SQLIntegrityConstraintViolationException e)
{e.printStackTrace();
    return Result.error("operation error");
}
@ExceptionHandler(LoginException.class)
public Result notLogin(LoginException e)
{
   e.printStackTrace();
   return  Result.error(e.getMessage());
}
}
